.TH ncftpls 1 "NcFTP Software" ncftpls
.SH NAME
ncftpls - Internet file transfer program for scripts
.SH "SYNOPSIS"
.PP
.B ncftpls
.RI [ "options" ]
.I "ftp://url.style/host/path/name/"
.\"-------
.SH "OPTIONS"
.\"-------
.SS
Command line flags:
.TP 8
.B \-m
Use a machine readable list format, if the server supports it.  This requires that the server software support the MLSD extensions, and many implementations do not have these features.
.TP 8
.B \-1
Most basic format, one item per line.
.TP 8
.B \-l
Long list format.
.TP 8
.B \-C
Columnized list format. This is the default list format.
.TP 8
.B \-R
Recurse all subdirectories while listing.
.TP 8
.B \-a
Show all files, if server allows it (as in "/bin/ls -a").
.TP 8
.BI "-i " "XX"
Filter the listing (if server supports it) with the wildcard
.IR "XX" "."
.TP 8
.BI "-x -" "XX"
Set the
.I ls
flags to use on the server.
.TP 8
.BI "-u " "XX"
Use username
.I XX
instead of anonymous.
.TP 8
.BI "-p " "XX"
Use password
.I XX
with the username.
.TP 8
.BI "-P " "XX"
Use port number
.I XX
instead of the default FTP service port (21).
.TP 8
.BI "-d " "XX"
Use the file
.I XX
for debug logging.
.TP 8
.BI "-t " "XX"
Timeout after
.I XX
seconds.
.TP 8
.B -E
Use regular (PORT) data connections.
.TP 8
.B -F
Use passive (PASV) data connections.
The default is to use passive, but to fallback to
regular if the passive connection fails or times out.
.TP 8
.BI "-r " "XX"
Redial a maximum of 
.I XX
times until connected to the remote FTP server.
.TP 8
.BI "-W " "XX"
Send raw FTP command
.I XX
after logging in.
.TP 8
.BI "-X " "XX"
Send raw FTP command
.I XX
after each file transferred.
.TP 8
.BI "-Y " "XX"
Send raw FTP command
.I XX
before logging out.
.IP
The
.BR "-W" ", " "-X" ", and " "-Y"
options are useful for advanced users who need to tweak
behavior on some servers.
For example, users accessing mainframes might need to send
some special SITE commands to set blocksize and record format information.
.IP
For these options, you can use them multiple times each if you need
to send multiple commands.
For the
.B "-X"
option, you can use the cookie
.B %s
to expand into the name of the file that was transferred.
.TP 8
.BI "-o " "XX"
Set advanced option
.IR "XX" "."
.IP
This option is used primarily for debugging.
It sets the value of an internal variable to an integer value.
An example usage would be:
.BI "-o " "useFEAT=0,useCLNT=1"
which in this case, disables use of the
FEAT command and enables the CLNT command.
The available variables include:
usePASV,
useSIZE,
useMDTM,
useREST,
useNLST_a,
useNLST_d,
useFEAT,
useMLSD,
useMLST,
useCLNT,
useHELP_SITE,
useSITE_UTIME,
STATfileParamWorks,
NLSTfileParamWorks,
require20,
allowProxyForPORT,
doNotGetStartCWD.
.\"-------
.SH "DESCRIPTION"
.\"-------
.PP
The
purpose of
.I ncftpls
is to do remote directory listings using
the File Transfer Protocol without entering an interactive shell.
This lets you write shell scripts or other unattended
processes that can do FTP.
.PP
The default behavior is to print the directory listing in columnized
format (i.e. ls\ \-CF), but that is not very useful for scripting.
This example uses the
.B \-1
flag, to print one file per line:
.RS 4
.br
.sp
$ ncftpls -1 ftp://ftp.ncftp.com/pub/ncftp/
.RE
.PP
You can also do a remote "ls\ \-l", by using "ncftpls\ \-l".
If you want to try other flags, you have to use them with the
.B \-x
flag.
For example, if you wanted to do a remote "ls\ \-lrt", you could
do this:
.RS 4
.br
.sp
$ ncftpls -x "-lrt" ftp://ftp.ncftp.com/pub/ncftp/
.RE
.PP
By default the program tries to open the remote host
and login anonymously, but you can specify a username
and password information like you can with
.I ncftpget
or
.IR ncftpput "."
.PP
Note that the standard specifies that URL pathnames are are relative pathnames.
For FTP, this means that URLs specify relative pathnames from the start
directory, which for user logins, are typically the user's home directory.
If you want to use absolute pathnames, you need to include a literal slash,
using the "%2F" code for a "/" character.  Examples:
.RS 4
.br
.sp
$ ncftpls -u linus ftp://ftp.kernel.org/%2Fusr/src/
.br
$ ncftpls ftp://steve@ftp.apple.com/%2Fetc/
.RE
.\"-------
.SH "DIAGNOSTICS"
.\"-------
.PP
.I ncftpls
returns the following exit values:
.TP 8
0
Success.
.TP 8
1
Could not connect to remote host.
.TP 8
2
Could not connect to remote host - timed out.
.TP 8
3
Transfer failed.
.TP 8
4
Transfer failed - timed out.
.TP 8
5
Directory change failed.
.TP 8
6
Directory change failed - timed out.
.TP 8
7
Malformed URL.
.TP 8
8
Usage error.
.TP 8
9
Error in login configuration file.
.TP 8
10
Library initialization failed.
.TP 8
11
Session initialization failed.
.\"-------
.SH "AUTHOR"
.\"-------
.PP
Mike Gleason, NcFTP Software (http://www.ncftp.com).
.\"-------
.SH "SEE ALSO"
.\"-------
.PP
.IR ncftpput (1),
.IR ncftpget(1),
.IR ncftp (1),
.IR ftp (1),
.IR rcp (1),
.IR tftp (1).
.PP
.IR "LibNcFTP" " (http://www.ncftp.com/libncftp/)."
